package org.lzfto.flink.demo.business.flinkTest.flinkObjects.connector.file;

import org.apache.flink.api.common.io.InputFormat;
import org.apache.flink.table.connector.source.InputFormatProvider;
import org.apache.flink.table.data.RowData;
import org.apache.flink.table.types.DataType;
import org.lzfto.flink.demo.business.flinkTest.base.record.ExcelOptionRecord;

public class CustExcelFormatProvider implements InputFormatProvider {

	private final ExcelOptionRecord option;
	private final DataType dataType;

	public CustExcelFormatProvider(ExcelOptionRecord option, DataType dataType) {
		this.option = option;
		this.dataType = dataType;
	}
	@Override
	public InputFormat<RowData, CustExcelSplit> createInputFormat() {
		return new CustExcelInputFormat(option, dataType);
	}

	@Override
	public boolean isBounded() {
		//必须设定为有界限，因为这里仅仅是读取一个静态文件。没有必要设置为无解
		//如果设置false就是无界限的，那么执行环境可能就需要做一个调整了
		return true;
	}

}
